package cn.dsp.admin.utils;

import lombok.Data;
import lombok.EqualsAndHashCode;

import java.io.Serializable;

/**
 * 封装响应的JSON结果的类
 * @param <T>
 */
@Data
@EqualsAndHashCode
public class JsonResult<T> implements Serializable {

    private static final long serialVersionUID = 8108138796578547572L;

    private Integer state;
    private String message;
    private T data;

    public JsonResult() {

    }

    public JsonResult(Integer state) {
        this.state = state;
    }

    public JsonResult(Throwable e) {
        this.message = e.getMessage();
    }

    public JsonResult(Integer state, T data) {
        this.state = state;
        this.data = data;
    }
}
